import { request } from "@/utils/service"

interface IRouteType {
  id?: number
  typeName: string
}

interface ICreateRouteTypeDataApi {
  typeName: string
}

type IChangeRouteTypeNameDataApi = ICreateRouteTypeDataApi

interface IGetRouteTypeListDataApi {
  /** 当前页码 */
  pageNum: number
  /** 查询条数 */
  pageSize: number
}

export function createRouteType(data: ICreateRouteTypeDataApi) {
  return request({
    url: "/travel/manage/route/type/create",
    method: "post",
    data
  })
}

export function changeRouteTypeName(id: number, data: IChangeRouteTypeNameDataApi) {
  return request({
    url: "/travel/manage/route/type/update/" + id,
    method: "put",
    data
  })
}

export function getRouteTypeList(params: IGetRouteTypeListDataApi) {
  return request({
    url: "/travel/manage/route/type/list",
    method: "get",
    params
  })
}

interface IRouteSubject {
  id?: number
  subjectName: string
}

interface ICreateRouteSubjectDataApi {
  subjectName: string
}

type IChangeRouteSubjectNameDataApi = ICreateRouteSubjectDataApi

interface IGetRouteSubjectListDataApi {
  /** 当前页码 */
  pageNum: number
  /** 查询条数 */
  pageSize: number
}

export function createRouteSubject(data: ICreateRouteSubjectDataApi) {
  return request({
    url: "/travel/manage/route/subject/create",
    method: "post",
    data
  })
}

export function changeRouteSubjectName(id: number, data: IChangeRouteSubjectNameDataApi) {
  return request({
    url: "/travel/manage/route/subject/update/" + id,
    method: "put",
    data
  })
}

export function getRouteSubjectList(params: IGetRouteSubjectListDataApi) {
  return request({
    url: "/travel/manage/route/subject/list",
    method: "get",
    params
  })
}

interface IRouteTemplate {
  id?: number
  templateName: string
  templateDays: number
}

interface ICreateRouteTemplateDataApi {
  templateName: string
  templateDays: number
}

type IChangeRouteTemplateNameDataApi = ICreateRouteTemplateDataApi

interface IGetRouteTemplateListDataApi {
  /** 当前页码 */
  pageNum: number
  /** 查询条数 */
  pageSize: number
}

export function createRouteTemplate(data: ICreateRouteTemplateDataApi) {
  return request({
    url: "/travel/manage/route/template/create",
    method: "post",
    data
  })
}

export function changeRouteTemplateName(id: number, data: IChangeRouteTemplateNameDataApi) {
  return request({
    url: "/travel/manage/route/template/update/" + id,
    method: "put",
    data
  })
}

export function getRouteTemplateList(params: IGetRouteTemplateListDataApi) {
  return request({
    url: "/travel/manage/route/template/list",
    method: "get",
    params
  })
}
